

const asar = require('asar');
const path = require('path');
const fs = require('fs-extra');
const { getPluginPath, mkdir } = require('./fileUtil')


exports.createPackage = function (pluginConfigPath) {
    const src = path.dirname(pluginConfigPath)
    const dst = path.join(src, "plugin.asar")
    asar.createPackage(src, dst);
    return dst
}



exports.movePackage = function (asarPath, uuid) {
    mkdir(getPluginPath())
    const dst = path.join(getPluginPath(), uuid + '.asar')
    process.noAsar = true
    fs.copyFile(asarPath, dst, (err) => { })
}
